package com.PVZ.model.plant;

import com.PVZ.model.Anime;
import com.PVZ.model.bullet.Bullet;
import com.PVZ.model.emuns.AnimeType;
import com.PVZ.model.emuns.EffectType;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.emuns.PlantType;
import com.PVZ.model.weapon.Bomb;
import com.PVZ.model.weapon.Weapon;
import com.PVZ.utils.Util;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ISY
 * @create 2021-06-01 16:03
 */
@Getter
@Setter
public class CherryBomb extends Plant {
    public CherryBomb(int row,int col,MoveType moveType) {
        super(PlantType.CherryBomb,row,col,moveType);
        this.setHealth(300);
        this.setBoxPadding(-20, -30, 90, 80);
        setWeapon(new Bomb());
        setAnime();
    }

    public CherryBomb(int row,int col) {
        super(PlantType.CherryBomb,row,col,MoveType.Stop);
        this.setHealth(300);
        this.setBoxPadding(-20, -30, 90, 80);

        setAnime();
        setWeapon(new Bomb());

    }

    public CherryBomb() {
        super(PlantType.CherryBomb, MoveType.Stop);
        this.setHealth(300);
        this.setImgSrc("res/img/plantPng/CherryBomb/Move/CherryBomb-2.png");
        setAnime();
        setWeapon(new Bomb());

    }


    @Override
    public void setAnime() {
        Map<AnimeType, Anime> animeMap = new HashMap<>();

        Anime anime = new Anime();
        //图片文件夹地址
        String src = "res/img/plantPng/CherryBomb/Move";
        anime.setAnimeSrc(src);
        anime.setAnimeIndex(0);
        anime.setAnimePlayMode(1);

        int startIndex = 1;
        int endIndex = 14;

        List<String> animeList = Util.addImageToList(startIndex, endIndex, src,"CherryBomb");
        anime.setAnimeList(animeList);

        //设置当前显示动画的地址
        anime.setCurPic(animeList.get(0));

        animeMap.put(AnimeType.MOVE, anime);
        animeMap.put(AnimeType.BREAK, getBreakAnime());

        setAnimeMap(animeMap);
    }

    public Anime getBreakAnime(){
        String src = "res/img/plantPng/CherryBomb/Break";
        int startIndex = 1;
        int endIndex = 5;

        return Util.createAnime(src, "break", startIndex, endIndex, 1);
    }

}
